package com.leyou.sms.config;


import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(SmsProperties.class)   // 把SmsProperties注入spring中
public class SmsConfiguration {

    @Bean
public IAcsClient client(SmsProperties prop){
    DefaultProfile profile = DefaultProfile.getProfile(
            prop.getRegionID(), prop.getAccessKeyID(), prop.getAccessKeySecret());
    return new DefaultAcsClient(profile);
}

}
